#include <iostream>
#include <memory>
#include <unistd.h>
using namespace std;
#include "ThreadPool_V4.hpp"
#include "Task.hpp"
int main()
{
    // unique_ptr<ThreadPool<Task>> ptr(new ThreadPool<Task>());
    // //对线程池进行初始化
    // ptr->init();
    // //使用线程池
    // ptr->start();
    // //查看线程
    // ptr->check();
    ThreadPool<Task>::gitinstance();
    printf("0x%x\n", ThreadPool<Task>::gitinstance());
    printf("0x%x\n", ThreadPool<Task>::gitinstance());
    printf("0x%x\n", ThreadPool<Task>::gitinstance());
    printf("0x%x\n", ThreadPool<Task>::gitinstance());

    while(true)
    {
        //生产者
        // sleep(1);
        int x,y;
        char op;
        cout<<"Please Enter x>";
        cin>>x;
        cout<<"Please Enter y>";
        cin>>y;
        cout<<"Please Enter op(+-*/%)>";
        cin>>op;
        Task t(x,y,op);
        ThreadPool<Task>::gitinstance()->pushTask(t);
        //ThreadPool<Task>::pushTask(t);
       // ptr->pushTask(t); //加载任务
    }
    return 0;
}